	//代理人openid
	var origopenid = getQueryString("openid");
	//点击人openid
	var currentopenid = getQueryString("currentopenid");
	//是否已经加载过图文列表 0 代表未加载
	var initloadphoto = 0;	
	//是否已经加载过视频列表 0 代表未加载
	var initloadvideo = 0;	
	//当前页面停留在图片还是视频列表 默认为图片
	var ispagetype = 'photo';
	//全部页数
	var totalPage_1 = '';
	//当前页数
	var start_1 = 1;
	var upTime_1,downTime_1;
	//全部页数
	var totalPage_2 = '';
	//当前页数
	var start_2 = 1;
	var upTime_2,downTime_2;
	//当前页数
	var start_3 = 1;
	var upTime_3,downTime_3;
	var totalPage_3 = '';
	//当前页数
	var start_4 = 1;
	var upTime_4,downTime_4;
	var totalPage_4 = '';
	//tab
	$(".tab").lt_tab({
		minItems: 3,
		scroll:true,
		changeMode : "click",
		callBack:function(currentIndex){
		}
	}); 


	$(function(){

		initAction();
		//关注
		$('#focus').on('click',function(){
			if ($(this).val() == '关注') {
				$(this).val('已关注').css({
						background: '#ff8606',
						color: '#fff'
					});
				$('.focus_icon').hide();
			}else if($(this).val() == '已关注'){
				$(this).val('关注').css({
						background: '#fefefe',
						color: '#676767'
					});
				$('.focus_icon').show();
			}
		});
		//投票
		$('#voate').on('click',function(){
			if ($(this).val() == '投票') {
				$(this).val('已投票').css({
						background: '#ff8606',
						color: '#fff'
					});
				$('.voate_icon').hide();
                voateFun();
            }else if($(this).val() == '已投票'){
				$(this).val('投票').css({
						background: '#fefefe',
						color: '#676767'
					});
				$('.voate_icon').show();
                voateCancleFun();
			}
		});
	});
	//初始化
	function initAction(){
		var foustmp=0;
		$.get(
		  API_URL+"agent/getbyopenid?openid="+origopenid+"&currentopenid="+currentopenid,
		  function(Obj){

		  	if(Obj.status.code == 0){
		  		
		  		var myData = Obj.data[0];
		  		
			  	//姓名&级别
			  	$(".teacher_brand h2").html(myData.name+'<span class="brand">'+myData.agent_level+'</span>');
			  	//头像
			  	if(myData.icon == null || myData.icon == ''){
						myData.icon ='../img/default.png';
				}
				$(".personal_infor img").attr("src",myData.icon);
				//粉丝量
				$(".fans_content p").html(myData.agent_fans_count);
				
				var showmessage = '认证讲师：新华保险';
				//判断该讲师类别 & 讲师认证

			  	if(myData.agent_category == 1){
			  		//明星讲师
			  		$(".tab_content_container").addClass("sliver");
			  		$(".brand_lecturer_con").addClass("first_gear");
			  		showmessage += myData.agent_level + '讲师';
			  	}else{
			  		//品牌讲师
			  		showmessage += myData.agent_level + '';
			  	}
			  	//未关注情况,原因该字段为字符串所以加上单引号
			  	if(myData.pa_fans == '0' ){
					foustmp = 1;
			  		showmessage += '<label class="focus" for="focus"><i class="add_icon"></i><input id="focus" type="button" value="关注"></label>';
					//alert(showmessage);
			  	}else if(myData.pa_fans == '1'){
					foustmp = 1;
			  		showmessage += '<label class="focus" for="focus"><input id="focus" type="button" value="取消关注"></label>';
				}
				$(".title_lecturer").html(showmessage);
				
				if(foustmp==1){
					//关注
					$('.focus').on('click',function(){
						Funsnum = $(".fans_content p").text();
						if ($("#focus").val() == '关注') {
							$.ajax({
								url: API_URL+"attention/add?openid="+currentopenid+"&origopenid="+openid,
								type: 'get',
								dataType: "JSON",
								data:'',
								async: false,
								success: function (obj){
									if(Obj.status.code == 0){
										newFuns = parseInt(Funsnum)+1;
										$(".fans_content p").text(newFuns);
										$(".focus").find('i').remove();
										$("#focus").val("取消关注");
									}else if(Obj.status.code == 2){
										newFuns = parseInt(Funsnum)+1;
										$(".fans_content p").text(newFuns);
										$(".focus").find('i').remove();
										$("#focus").val("取消关注");
									}
								},
								error: function (data){
									console.log("服务器异常!");
								}
							});
							
						}else{
							$.ajax({
								url: API_URL+"attention/cancel?openid="+currentopenid+"&origopenid="+openid,
								type: 'get',
								dataType: "JSON",
								data:'',
								async: false,
								success: function (obj){
									if(Obj.status.code == 0){
										newFuns = parseInt(Funsnum)-1;
										$(".fans_content p").text(newFuns);
										$("#focus").before('<i class="add_icon"></i>');
										$("#focus").val("关注");
									}else if(Obj.status.code == 2){
										newFuns = parseInt(Funsnum)-1;
										$(".fans_content p").text(newFuns);
										$("#focus").before('<i class="add_icon"></i>');
										$("#focus").val("关注");
									}
								},
								error: function (data){
									console.log("服务器异常!");
								}
							});
							
						}
					});
				}
			}

		  });
		
		
		//默认调用图文一次
		ontabtype('photo');
		
		
	}

	//点击选项卡
	function ontabtype(type){
		ispagetype = type;

		if(type == 'photo'){
			if(initloadphoto != 0){
				return;
			}
		}

		if(type == 'video'){
			if(initloadvideo != 0){
				return;
			}
		}
		if(type == 'pdf'){
			if(initloadvideo != 0){
				return;
			}
		}
		if(type == 'example'){
			if(initloadvideo != 0){
				return;
			}
		}

		$.get(
		  API_URL+"agentclub/main?origopenid="+origopenid+"&openid="+currentopenid+"&type="+type,
		  function(Obj){
		  	var myData = Obj.basedata.data;
			if(myData.length < 10){
					if(type == 'photo'){
						$("#pullUp_1").hide();
					}

					if(type == 'video'){
						$("#pullUp_2").hide();
					}
					if(type == 'pdf'){
						$("#pullUp_3").hide();
					}
					if(type == 'example'){
						$("#pullUp_4").hide();
					}
				}

		  	if(myData.length > 0){
				
		  		if(ispagetype == "photo"){

		  			if(Obj.basedata.operation == "down"){
						downTime_1 = myData[0].createtime_time;
					}else if(Obj.basedata.operation == "up"){
						upTime_1 = myData[myData.length-1].createtime_time;

					}else {
						upTime_1 = myData[myData.length-1].createtime_time;
						downTime_1 = myData[0].createtime_time;
					}

		  		}else if(ispagetype == "video"){
					
		  			if(Obj.basedata.operation == "down"){
						downTime_2 = myData[0].createtime_time;
					}else if(Obj.basedata.operation == "up"){
						upTime_2 = myData[myData.length-1].createtime_time;

					}else {
						upTime_2 = myData[myData.length-1].createtime_time;
						downTime_2 = myData[0].createtime_time;
					}
		  		}
		  		else if(ispagetype == "pdf"){
					
		  			if(Obj.basedata.operation == "down"){
						downTime_3 = myData[0].createtime_time;
					}else if(Obj.basedata.operation == "up"){
						upTime_3 = myData[myData.length-1].createtime_time;

					}else {
						upTime_3 = myData[myData.length-1].createtime_time;
						downTime_3 = myData[0].createtime_time;
					}
		  		}
		  		else if(ispagetype == "example"){
					
		  			if(Obj.basedata.operation == "down"){
						downTime_4 = myData[0].createtime_time;
					}else if(Obj.basedata.operation == "up"){
						upTime_4 = myData[myData.length-1].createtime_time;

					}else {
						upTime_4 = myData[myData.length-1].createtime_time;
						downTime_4 = myData[0].createtime_time;
					}
		  		}

				
				

				//加载更多
				for(var i = 0 ; i < myData.length ; i++ ){
					//默认加载为up
			  		initload(myData,type,i,'up');
			  	}



			  	if(type == 'photo'){
		  			initloadphoto = 1;
			  	}

			  	if(type == 'video'){
					initloadvideo = 1;
				}
				if(type == 'pdf'){
					initloadvideo = 1;
				}
				if(type == 'example'){
					initloadvideo = 1;
				}
			}

		  });

		//初始化socill
		setTimeout(loaded(), 500);

	}

	//加载图文与视频列表方法
	function initload(myData,type,i,pulltype){
		
		if(myData[i].agent_icon == null || myData[i].agent_icon == ''){

			myData[i].agent_icon = '../img/default.png';
		}

		if(type == 'photo'){

			var str = '<div class="items_content">'+
							'<input type="hidden" value=\"'+myData[i].id+'\" id="itemsId" />'+
							'<a href="status_detial.html?agentopenid='+openid+'&openid='+currentopenid+'&detialId='+myData[i].id+'&user_status='+user_status+'"><div>'+
								'<dl>'+
									'<dd><img src=\"'+myData[i].agent_icon+'\" alt=""></dd>'+
									'<dt>'+
										'<h3>'+myData[i].agent_name;
										if(myData[i].agent_category==2){
											str +='<span class=""></span>';
										}else{
											str +='<span class="brand_icon"></span>';
										}
										
									str += '</h3>'+
										'<p class="time">'+myData[i].createtime_str+'</p>'+
									'</dt>'+
								'</dl>'+
								'<p class="published_text clear">'+myData[i].content+'</p>';
								if(myData[i].photo != null && myData[i].photo != ''){

									str += '<img src=\"'+myData[i].photo+'\" alt="">';
								}
							str += '</div></a>'+
							'<div class="focus_content">'+
								'<span class="share_btn" ><i class="share_num"></i>'+myData[i].forwardcount+'</span>'+
								'<span class="talk_btn" ><i class="talk_num"></i>'+myData[i].commentcount+'</span>';

								if(myData[i].pa_state == 0){
									 str +='<span class="well_btn"><i class="well_num"></i><em>'+myData[i].praisecount+'</em></span>';
								}else{
									 str +='<span class="well_btn"><i class="well_num welldone"></i><em>'+myData[i].praisecount+'</em></span>';
								}

					str +='</div>'+
						'</div>';

			if(pulltype == "down"){
				$(".text_content.photo").before(str);
			}else{
				$(".text_content.photo").append(str);
			}

			$('.welldone').next('em').css('color','#f6b549');
		}else{

			var str = '<div class="items_content">'+
							'<input type="hidden" value=\"'+myData[i].id+'\" id="itemsId" />'+
							'<a href="status_detial.html?agentopenid='+openid+'&openid='+currentopenid+'&detialId='+myData[i].id+'&user_status='+user_status+'"><div>'+
								'<dl>'+
									'<dd><img src=\"'+myData[i].agent_icon+'\" alt=""></dd>'+
									'<dt>'+
										'<h3>'+myData[i].agent_name+'<span class="brand_icon"></span></h3>'+
										'<p class="time">'+myData[i].createtime_str+'</p>'+
									'</dt>'+
								'</dl>'+
								'<p class="published_text clear">'+myData[i].title+'</p>'+
								 '<iframe height="140" width="181" src=\"'+myData[i].url+'\" frameborder=0 allowfullscreen></iframe>'+
											'<ul class="radiolabel_content" >'+
												'<li style="display: inline-block;height: 14px;line-height: 14px;margin: 8px 4px 20px 0;background: #fff;border: none;"><span style="display: inline-block;padding: 3px 5px;text-align: center;border-radius: 3px;font-size: 9px;border: 1px solid #43aaf1;color: #43aaf1;margin: 8px 4px 12px 0;">'+myData[i].channelname+'</span></li>'+
												'<li style="display: inline-block;height: 14px;line-height: 14px;margin: 8px 4px 20px 0;background: #fff;border: none;"><span style="display: inline-block;padding: 3px 5px;text-align: center;border-radius: 3px;font-size: 9px;border: 1px solid #43aaf1;color: #43aaf1;margin: 8px 4px 12px 0;">'+myData[i].curriculumtypename+'</span></li>'+
												'<li style="display: inline-block;height: 14px;line-height: 14px;margin: 8px 4px 20px 0;background: #fff;border: none;"><span style="display: inline-block;padding: 3px 5px;text-align: center;border-radius: 3px;font-size: 9px;border: 1px solid #43aaf1;color: #43aaf1;margin: 8px 4px 12px 0;">'+myData[i].standardname+'</span></li>'+
											'</ul>'+
							'</div></a>'+
							'<div class="focus_content clear">'+
								'<span><i class="share_num"></i>'+myData[i].forwardcount+'</span>'+
								'<span class="talk_btn" ><i class="talk_num"></i>'+myData[i].commentcount+'</span>';

								if(myData[i].pa_state == 0){
									 str +='<span class="well_btn"><i class="well_num"></i><em>'+myData[i].praisecount+'</em></span>';
								}else{
									 str +='<span class="well_btn"><i class="well_num welldone"></i><em>'+myData[i].praisecount+'</em></span>';
								}
								
					  str +='</div>'+
						'</div>';

			if(pulltype == "down"){
				$(".text_content.video").before(str);
			}else{
				$(".text_content.video").append(str);
			}
			$('.welldone').next('em').css('color','#f6b549');
		}		
		
		//赞
		$('.well_btn').on('click',function(){
			if ($(this).find("i").hasClass('welldone')) {
				cancelFun($(this));
			}else {
				wellDoneFun($(this));	
			}
		});
		


		//评论
		

		$('.talk_btn').on('click',function(){

			var detialId = $(this).parents('.items_content').children('#itemsId').val();

			window.location = 'status_detial.html?agentopenid='+openid+'&openid='+currentopenid+'&detialId='+detialId+'&user_status='+user_status;
		});

		


		//转发
		//图文
		$('.share_btn').on('click',function(){

			var detialId = $(this).parents('.items_content').children('#itemsId').val();

			window.location = 'status_detial.html?agentopenid='+openid+'&openid='+currentopenid+'&detialId='+detialId+'&user_status='+user_status;
			
		});
		
		//视频
		$('.share_num').on('click',function(){

			var detialId = $(this).parents('.items_content').children('#itemsId').val();

			window.location = 'status_detial.html?agentopenid='+openid+'&openid='+currentopenid+'&detialId='+detialId+'&user_status='+user_status;
			
		});
			

		
		
	}



//点赞
function wellDoneFun(wellobj){
	var detialId = $(wellobj).parents('.items_content').children('#itemsId').val();
	$.ajax({
		url: API_URL+'curriculum/praise?openid='+currentopenid+'&curriculumid='+detialId,
		type: 'post',
		dataType: "JSON",
		data:'',
		async: false,
		success: function (obj){
			if (obj.status.code == 0) {
					var numNew = parseInt($(wellobj).find("em").text())+ parseInt(1);
					$(wellobj).html('<i class="well_num welldone"></i><em>'+numNew+'</em>');
					$('.welldone').next('em').css('color','#f6b549');
				}
		},
		error: function (data){
			console.log("服务器异常!");
		}
	});
}
//取消赞
function cancelFun(wellobj){
	var detialId = $(wellobj).parents('.items_content').children('#itemsId').val();
	$.ajax({
		url: API_URL+'curriculum/cancelpraise?openid='+currentopenid+'&curriculumid='+detialId,
		type: 'post',
		dataType: "JSON",
		data:'',
		async: false,
		success: function (obj){
			if (obj.status.code == 0) {
					var numNew = parseInt($(wellobj).find("em").text()) - parseInt(1);
					$(wellobj).html('<i class="well_num"></i><em>'+numNew+'</em>');
				}
		},
		error: function (data){
			console.log("服务器异常!");
		}
	});
}

	var myScroll_1,
		pullDownEl_1, pullDownOffset_1,
		pullUpEl_1, pullUpOffset_1,
		generatedCount_1 = 0;

	var myScroll_2,
		pullDownEl_2, pullDownOffset_2,
		pullUpEl_2, pullUpOffset_2,
		generatedCount_2 = 0;

	var myScroll_3,
		pullDownEl_3, pullDownOffset_3,
		pullUpEl_3, pullUpOffset_3,
		generatedCount_3 = 0;

	var myScroll_4,
		pullDownEl_4, pullDownOffset_4,
		pullUpEl_4, pullUpOffset_4,
		generatedCount_4 = 0;

	function pullDownAction (type) {
		setTimeout(function () {	// <-- Simulate network congestion, remove setTimeout from production!
			if("photo" == type){
				detialFun('agentclub/main?operation=down&createtime_time='+downTime_1+'&origopenid='+origopenid+'&type='+type,'down');
				myScroll_1.refresh();		// Remember to refresh when contents are loaded (ie: on ajax completion)
			}else if("video" == type) {
				detialFun('agentclub/main?operation=down&createtime_time='+downTime_2+'&origopenid='+origopenid+'&type='+type,'down');
				myScroll_2.refresh();		// Remember to refresh when contents are loaded (ie: on ajax completion)
			}else if ("pdf" == type){
				detialFun('agentclub/main?operation=down&createtime_time='+downTime_2+'&origopenid='+origopenid+'&type='+type,'down');
				myScroll_3.refresh();	

			}else if ('example' == type){
				detialFun('agentclub/main?operation=down&createtime_time='+downTime_2+'&origopenid='+origopenid+'&type='+type,'down');
				myScroll_4.refresh();	
			}
		}, 1000);	// <-- Simulate network congestion, remove setTimeout from production!
	}

	function pullUpAction (type) {
		setTimeout(function () {	// <-- Simulate network congestion, remove setTimeout from production!
			if("photo" == type){
				detialFun('agentclub/main?operation=up&createtime_time='+upTime_1+'&origopenid='+origopenid+'&type='+type,'up');
				myScroll_1.refresh();		// Remember to refresh when contents are loaded (ie: on ajax completion)
			}else if("video" == type) {
				detialFun('agentclub/main?operation=up&createtime_time='+upTime_2+'&origopenid='+origopenid+'&type='+type,'up');
				myScroll_2.refresh();		// Remember to refresh when contents are loaded (ie: on ajax completion)
			}else if("pdf" == type){
				detialFun('agentclub/main?operation=up&createtime_time='+upTime_2+'&origopenid='+origopenid+'&type='+type,'up');
				myScroll_3.refresh();	
			}else if("example" == type){
				detialFun('agentclub/main?operation=up&createtime_time='+upTime_2+'&origopenid='+origopenid+'&type='+type,'up');
				myScroll_4.refresh();	
			}
		}, 1000);	// <-- Simulate network congestion, remove setTimeout from production!
	}

    //投票
    function voateFun(obj){
        $.get(
                API_URL+"agentvote/add?openid="+openid+"&origopenid="+origopenid,
            function(Obj){
              if (Obj.status.code == 0) {
                   alert('投票成功');
              }else if (Obj.status.code == 1) {
                  alert('您还没认证，请认证后再进行投票');
              }else if (Obj.status.code == 2) {
                  alert('您票数已用完');
              }else if (Obj.status.code == 3) {
                  alert('您已给该讲师投过票');
              }
        });
    }
    //取消投票
    function voateCancleFun(obj){
        $.get(
                API_URL+"agentvote/delete?openid="+openid+"&origopenid="+origopenid,
            function(Obj){
                if (Obj.status.code == 0) {
                    alert('取消投票成功');
                }else if (Obj.status.code == 1) {
                    alert('您还未给该讲师投票');
                }else if (Obj.status.code == -1) {
                    alert('系统异常');
                }
            });
    }

	//滑动加载更多列表
	function detialFun(arg_url,pulltype){
		$.ajax({
			url: API_URL+arg_url,
			type: 'GET',
			dataType: "JSON",
			data:'',
			async: false,
			success: function (obj){
				if (obj.status.code == 0) {
					var myData = obj.basedata.data;
					if(myData.length > 0){

						if(ispagetype == "photo"){

							$('#pullUp_1').show();

							if(obj.basedata.operation == "down"){
								downTime_1 = myData[0].createtime_time;
							}else if(obj.basedata.operation == "up"){
								upTime_1 = myData[myData.length-1].createtime_time;

							}else {
								upTime_1 = myData[myData.length-1].createtime_time;
								downTime_1 = myData[0].createtime_time;
							}

						}else if(ispagetype == "video"){

							$('#pullUp_2').show();

							if(obj.basedata.operation == "down"){
								downTime_2 = myData[0].createtime_time;
							}else if(obj.basedata.operation == "up"){
								upTime_2 = myData[myData.length-1].createtime_time;

							}else {
								upTime_2 = myData[myData.length-1].createtime_time;
								downTime_2 = myData[0].createtime_time;
							}

						}else if(ispagetype == "pdf"){

							$('#pullUp_3').show();

							if(obj.basedata.operation == "down"){
								downTime_3 = myData[0].createtime_time;
							}else if(obj.basedata.operation == "up"){
								upTime_3 = myData[myData.length-1].createtime_time;

							}else {
								upTime_3 = myData[myData.length-1].createtime_time;
								downTime_3 = myData[0].createtime_time;
							}

						}else if(ispagetype == "example"){

							$('#pullUp_4').show();

							if(obj.basedata.operation == "down"){
								downTime_4 = myData[0].createtime_time;
							}else if(obj.basedata.operation == "up"){
								upTime_4 = myData[myData.length-1].createtime_time;

							}else {
								upTime_4 = myData[myData.length-1].createtime_time;
								downTime_4 = myData[0].createtime_time;
							}

						}

						//加载更多
						for(var i = 0 ; i < myData.length ; i++ ){
					  		initload(myData,ispagetype,i,pulltype);
					  	}
					}else{

						if(ispagetype == "photo"){
							$('#pullUp_1').hide();
						}else if(ispagetype == "video"){
							$('#pullUp_2').hide();
						}else if(ispagetype == "pdf"){
							$('#pullUp_3').hide();
						}else if(ispagetype == "example"){
							$('#pullUp_4').hide();
						}
						
					}
				}
					
			},
			error: function (data){
				console.log("服务器异常!");
			}
		});
	}


function loaded() {

	if(ispagetype == "photo"){

		pullDownEl_1 = document.getElementById('pullDown_1');
		pullDownOffset_1 = pullDownEl_1.offsetHeight;
		pullUpEl_1 = document.getElementById('pullUp_1');
		pullUpOffset_1 = pullUpEl_1.offsetHeight;
		
		myScroll_1 = new iScroll('wrapper_1', {
			useTransition: true,
			topOffset: pullDownOffset_1,
			onRefresh: function () {
				if (pullDownEl_1.className.match('loading')) {
					pullDownEl_1.className = '';
					pullDownEl_1.querySelector('.pullDownLabel').innerHTML = '下拉刷新...';
				} else if (pullUpEl_1.className.match('loading')) {
					pullUpEl_1.className = '';
					pullUpEl_1.querySelector('.pullUpLabel').innerHTML = '上拉加载更多...';
				}
			},
			onScrollMove: function () {
				if (this.y > 5 && !pullDownEl_1.className.match('flip')) {
					pullDownEl_1.className = 'flip';
					pullDownEl_1.querySelector('.pullDownLabel').innerHTML = '释放刷新...';
					this.minScrollY = 0;
				} else if (this.y < 5 && pullDownEl_1.className.match('flip')) {
					pullDownEl_1.className = '';
					pullDownEl_1.querySelector('.pullDownLabel').innerHTML = '下拉刷新...';
					this.minScrollY = -pullDownOffset_1;
				} else if (this.y < (this.maxScrollY - 5) && !pullUpEl_1.className.match('flip')) {
					pullUpEl_1.className = 'flip';
					pullUpEl_1.querySelector('.pullUpLabel').innerHTML = '释放刷新...';
					this.maxScrollY = this.maxScrollY;
				} else if (this.y > (this.maxScrollY + 5) && pullUpEl_1.className.match('flip')) {
					pullUpEl_1.className = '';
					pullUpEl_1.querySelector('.pullUpLabel').innerHTML = '上拉加载更多...';
					this.maxScrollY = pullUpOffset_1;
				}
			},
			onScrollEnd: function () {
				if (pullDownEl_1.className.match('flip')) {
					pullDownEl_1.className = 'loading';
					pullDownEl_1.querySelector('.pullDownLabel').innerHTML = '加载中...';				
					pullDownAction('photo');	// Execute custom function (ajax call?)
				} else if (pullUpEl_1.className.match('flip')) {
					pullUpEl_1.className = 'loading';
					pullUpEl_1.querySelector('.pullUpLabel').innerHTML = '加载中...';				
					pullUpAction('photo');	// Execute custom function (ajax call?)
				}
			}
		});
		
		setTimeout(function () { document.getElementById('wrapper_1').style.left = '0'; }, 800);

	}else if(ispagetype == "video"){

		pullDownEl_2 = document.getElementById('pullDown_2');
		pullDownOffset_2 = pullDownEl_2.offsetHeight;
		pullUpEl_2 = document.getElementById('pullUp_2');
		pullUpOffset_2 = pullUpEl_2.offsetHeight;
		
		myScroll_2 = new iScroll('wrapper_2', {
			useTransition: true,
			topOffset: pullDownOffset_2,
			onRefresh: function () {
				if (pullDownEl_2.className.match('loading')) {
					pullDownEl_2.className = '';
					pullDownEl_2.querySelector('.pullDownLabel').innerHTML = '下拉刷新...';
				} else if (pullUpEl_2.className.match('loading')) {
					pullUpEl_2.className = '';
					pullUpEl_2.querySelector('.pullUpLabel').innerHTML = '上拉加载更多...';
				}
			},
			onScrollMove: function () {
				if (this.y > 5 && !pullDownEl_2.className.match('flip')) {
					pullDownEl_2.className = 'flip';
					pullDownEl_2.querySelector('.pullDownLabel').innerHTML = '释放刷新...';
					this.minScrollY = 0;
				} else if (this.y < 5 && pullDownEl_2.className.match('flip')) {
					pullDownEl_2.className = '';
					pullDownEl_2.querySelector('.pullDownLabel').innerHTML = '下拉刷新...';
					this.minScrollY = -pullDownOffset_2;
				} else if (this.y < (this.maxScrollY - 5) && !pullUpEl_2.className.match('flip')) {
					pullUpEl_2.className = 'flip';
					pullUpEl_2.querySelector('.pullUpLabel').innerHTML = '释放刷新...';
					this.maxScrollY = this.maxScrollY;
				} else if (this.y > (this.maxScrollY + 5) && pullUpEl_2.className.match('flip')) {
					pullUpEl_2.className = '';
					pullUpEl_2.querySelector('.pullUpLabel').innerHTML = '上拉加载更多...';
					this.maxScrollY = pullUpOffset_2;
				}
			},
			onScrollEnd: function () {
				if (pullDownEl_2.className.match('flip')) {
					pullDownEl_2.className = 'loading';
					pullDownEl_2.querySelector('.pullDownLabel').innerHTML = '加载中...';				
					pullDownAction('video');	// Execute custom function (ajax call?)
				} else if (pullUpEl_2.className.match('flip')) {
					pullUpEl_2.className = 'loading';
					pullUpEl_2.querySelector('.pullUpLabel').innerHTML = '加载中...';				
					pullUpAction('video');	// Execute custom function (ajax call?)
				}
			}
		});
		
		setTimeout(function () { document.getElementById('wrapper_2').style.left = '0'; }, 800);

	}else if(ispagetype == "pdf"){

		pullDownEl_3 = document.getElementById('pullDown_3');
		pullDownOffset_3 = pullDownEl_3.offsetHeight;
		pullUpEl_3 = document.getElementById('pullUp_3');
		pullUpOffset_3 = pullUpEl_3.offsetHeight;
		
		myScroll_3 = new iScroll('wrapper_3', {
			useTransition: true,
			topOffset: pullDownOffset_3,
			onRefresh: function () {
				if (pullDownEl_3.className.match('loading')) {
					pullDownEl_3.className = '';
					pullDownEl_3.querySelector('.pullDownLabel').innerHTML = '下拉刷新...';
				} else if (pullUpEl_3.className.match('loading')) {
					pullUpEl_3.className = '';
					pullUpEl_3.querySelector('.pullUpLabel').innerHTML = '上拉加载更多...';
				}
			},
			onScrollMove: function () {
				if (this.y > 5 && !pullDownEl_3.className.match('flip')) {
					pullDownEl_3.className = 'flip';
					pullDownEl_3.querySelector('.pullDownLabel').innerHTML = '释放刷新...';
					this.minScrollY = 0;
				} else if (this.y < 5 && pullDownEl_3.className.match('flip')) {
					pullDownEl_3.className = '';
					pullDownEl_3.querySelector('.pullDownLabel').innerHTML = '下拉刷新...';
					this.minScrollY = -pullDownOffset_3;
				} else if (this.y < (this.maxScrollY - 5) && !pullUpEl_3.className.match('flip')) {
					pullUpEl_3.className = 'flip';
					pullUpEl_3.querySelector('.pullUpLabel').innerHTML = '释放刷新...';
					this.maxScrollY = this.maxScrollY;
				} else if (this.y > (this.maxScrollY + 5) && pullUpEl_3.className.match('flip')) {
					pullUpEl_3.className = '';
					pullUpEl_3.querySelector('.pullUpLabel').innerHTML = '上拉加载更多...';
					this.maxScrollY = pullUpOffset_3;
				}
			},
			onScrollEnd: function () {
				if (pullDownEl_3.className.match('flip')) {
					pullDownEl_3.className = 'loading';
					pullDownEl_3.querySelector('.pullDownLabel').innerHTML = '加载中...';				
					pullDownAction('video');	// Execute custom function (ajax call?)
				} else if (pullUpEl_3.className.match('flip')) {
					pullUpEl_3.className = 'loading';
					pullUpEl_3.querySelector('.pullUpLabel').innerHTML = '加载中...';				
					pullUpAction('video');	// Execute custom function (ajax call?)
				}
			}
		});
		
		setTimeout(function () { document.getElementById('wrapper_3').style.left = '0'; }, 800);

	}else if(ispagetype == "pdf"){

		pullDownEl_4 = document.getElementById('pullDown_4');
		pullDownOffset_4 = pullDownEl_4.offsetHeight;
		pullUpEl_4 = document.getElementById('pullUp_4');
		pullUpOffset_4 = pullUpEl_4.offsetHeight;
		
		myScroll_4 = new iScroll('wrapper_4', {
			useTransition: true,
			topOffset: pullDownOffset_4,
			onRefresh: function () {
				if (pullDownEl_4.className.match('loading')) {
					pullDownEl_4.className = '';
					pullDownEl_4.querySelector('.pullDownLabel').innerHTML = '下拉刷新...';
				} else if (pullUpEl_4.className.match('loading')) {
					pullUpEl_4.className = '';
					pullUpEl_4.querySelector('.pullUpLabel').innerHTML = '上拉加载更多...';
				}
			},
			onScrollMove: function () {
				if (this.y > 5 && !pullDownEl_4.className.match('flip')) {
					pullDownEl_4.className = 'flip';
					pullDownEl_4.querySelector('.pullDownLabel').innerHTML = '释放刷新...';
					this.minScrollY = 0;
				} else if (this.y < 5 && pullDownEl_4.className.match('flip')) {
					pullDownEl_4.className = '';
					pullDownEl_4.querySelector('.pullDownLabel').innerHTML = '下拉刷新...';
					this.minScrollY = -pullDownOffset_4;
				} else if (this.y < (this.maxScrollY - 5) && !pullUpEl_4.className.match('flip')) {
					pullUpEl_4.className = 'flip';
					pullUpEl_4.querySelector('.pullUpLabel').innerHTML = '释放刷新...';
					this.maxScrollY = this.maxScrollY;
				} else if (this.y > (this.maxScrollY + 5) && pullUpEl_4.className.match('flip')) {
					pullUpEl_4.className = '';
					pullUpEl_4.querySelector('.pullUpLabel').innerHTML = '上拉加载更多...';
					this.maxScrollY = pullUpOffset_4;
				}
			},
			onScrollEnd: function () {
				if (pullDownEl_4.className.match('flip')) {
					pullDownEl_4.className = 'loading';
					pullDownEl_4.querySelector('.pullDownLabel').innerHTML = '加载中...';				
					pullDownAction('video');	// Execute custom function (ajax call?)
				} else if (pullUpEl_4.className.match('flip')) {
					pullUpEl_4.className = 'loading';
					pullUpEl_4.querySelector('.pullUpLabel').innerHTML = '加载中...';				
					pullUpAction('video');	// Execute custom function (ajax call?)
				}
			}
		});
		
		setTimeout(function () { document.getElementById('wrapper_4').style.left = '0'; }, 800);

	}

}
